package 类加载器;

/**
 * <P> @Author: ideaAdmin
 * <P> TODO: Class
 * <P> TODO:
 * <P> Date: 2022/3/30:17:52
 * <P> Description:
 */

public class Person {
    private String name;

    public Person(String name) {
        this.name = name;
    }

    public static void swap(Person p1, Person p2){
        Person temp = p1;
        p1.name = p2.name;
        p2.name = temp.name;
        System.out.println(p1.getName());
        System.out.println(p2.getName());
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static void main(String[] args) {
        Person zhangsan = new Person("zhangsan");
        Person wang = new Person("wang");
        swap(zhangsan,wang);
        System.out.println(zhangsan.getName());
        System.out.println(wang.getName());
    }
}
